<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <jsp:include page="../common/header.jsp"/>
    <jsp:include page="../../common/layer.jsp"></jsp:include>
     <jsp:include page="../../common/mydate.jsp"></jsp:include>
</head>
<body>
<form action="${pathUrl }/admin/order/indexList" method="post" id="userForm">
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">订单管理</a></li>
    </ul>
</div>

<div class="session-main">
    <table style="border: 0px;width:100%;">
      <tr>
       <td align="left" width="10%">

       </td>
       <td align="right" width="90%">
	       <ul class="seachform" style="margin-top: 15px;float: right;">
       		   <li><label>订单号：</label><input name="orderSn" type="text" class="scinput"></li>
	        <li><label>&nbsp;</label><input name="" type="button" class="scbtn" onclick="ajaxLoad()" value="查询"></li>
	    </ul>
       </td>
      </tr>
    </table>
    
    <div id="loadDiv">
        <table class="tablelist">
            <thead>
            <tr>
                <th width="50%" align="center">基本信息</th>
                <th width="10%" align="center" class="align-center-go">价格</th>
                <th width="10%" align="center" class="align-center-go">数量</th>
                <th width="10%" align="center" class="align-center-go">金额</th>
                <th width="20%" align="center" class="align-center-go">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:choose>
                <c:when test="${orderGoodsVoList.size()>0 }">
                    <c:forEach items="${orderGoodsVoList}" var="vo" varStatus="status">
                        <tr>
                            <td colspan="5" class="pda">
                                <table class="item-order">
                                    <tbody>
                                    <% %>
                                    <tr>
                                        <td colspan="2" class="order_td">
                                            订单号:${vo.shopOrder.orderSn }&nbsp;&nbsp;&nbsp;下单时间：<%--<f:formatDate value="${vo.addTime }" pattern="yyyy-MM-dd HH:mm:sss"/>--%>
                                            &nbsp;&nbsp;状态：
                                            <c:choose>
                                                <c:when test="${vo.shopOrder.shopState eq 0 }">未支付</c:when>
                                                <c:when test="${vo.shopOrder.shopState eq 1 }">已支付</c:when>
                                                <c:when test="${vo.shopOrder.shopState eq 2 }">已确认，已发货</c:when>
                                                <c:when test="${vo.shopOrder.shopState eq -1 }">已取消</c:when>
                                            </c:choose>
                                            &nbsp;&nbsp;收货地址：${vo.shopOrder.province}${vo.shopOrder.city}${vo.shopOrder.area}${vo.shopOrder.address}
                                            &nbsp;&nbsp;收货人：${vo.shopOrder.userName }&nbsp;&nbsp;手机号码：${vo.shopOrder.phone }
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="80%">
                                            <table class="order-item-go" >
                                                <tbody>
                                                <c:forEach var="ch" items="${vo.orderGoodsListVo }">
                                                    <tr>
                                                        <td width="50%" style="padding: 5px;">
                                                            <img  onerror="this.src='${pathUrl }/public/images/nopic.png'"  src="${pathUrl}${ch.shopOrderGoods.goodsImg}" class="goods"  onerror="this.src='${pathUrl }/public/images/nopic.png'" >
                                                            <p style="font-weight: bold;">
                                                                    ${ch.shopOrderGoods.goodsName}
                                                            </p>
                                                            <p>货号：${ch.shopOrderGoods.goodsSn }</p>
                                                            <p>分类：${ch.goodsCatalog.name }</p>
                                                        </td>
                                                        <td width="10%" align="center">${ch.shopOrderGoods.price}</td>
                                                        <td width="10%" align="center">${ch.shopOrderGoods.goNum }</td>
                                                        <td width="10%" align="center">${ch.shopOrderGoods.totalPrice }</td>
                                                    </tr>
                                                </c:forEach>
                                                </tbody>
                                            </table>
                                        </td>
                                        <td width="20%" style="text-align: center!important;">
                                            <c:choose>
                                                <c:when test="${vo.shopOrder.shopState eq 1 }">
                                                    <a href="javascript:;" onclick="cancel(${vo.shopOrder.id })" class="tablelink">取消</a>
                                                    <a href="javascript:;" onclick="confirmYes(${vo.shopOrder.id })" class="tablelink">确认</a>
                                                </c:when>
                                                <c:when test="${vo.shopOrder.shopState eq -1 }">已取消</c:when>
                                                <c:when test="${vo.shopOrder.shopState eq 2 }">已发货</c:when>
                                            </c:choose>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </c:forEach>
                </c:when>
                <c:otherwise>
                    <tr>
                        <td colspan="5">暂无数据！</td>
                    </tr>
                </c:otherwise>
            </c:choose>
            </tbody>
        </table>
        <input type="hidden" id="pageNum" name="pageNum" value="${pageNum }"/>
        <input type="hidden" id="pages" name="pages" value="${pages }"/>
        <input type="hidden" id="total" name="total" value="${total }"/>
        <input type="hidden" id="pageSize" name="pageSize" value="${pageSize }"/>
    </div>
    <div id="pagerDiv"></div>

   
</div>
</form>
<jsp:include page="../../common/laypage.jsp"/>
<script type="text/javascript">
$(function(){

});


	function cancel(orderid){
		ydlConfrim("是否取消订单？",function(){
			var url="${pathUrl}/admin/order/orderCancel";
			$.post(url,{orderId:orderid},function(result){
                ydlMsg(result.msg);
			    if(result.status = 1){
                    window.location.href = "${pathUrl}/admin/order/index";
                }

			});
		});
		

 	}
 	
 	function confirmYes(orderid,currentPage){
		ydlConfrim("是否确定订单？",function(){
			var url="${pathUrl}/admin/order/orderConfirm";
			$.post(url,{orderId:orderid},function(result){
				ydlMsg(result.msg);
                if(result.status = 1){
                    window.location.href = "${pathUrl}/admin/order/index";
                }
			});
		});
 	}
</script>
</body>
</html>